package com.ruoyi.cinema.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.cinema.domain.CarouselFigure;
import com.ruoyi.cinema.mapper.CarouselFigureMapper;
import com.ruoyi.cinema.service.ICarouselFigureService;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 轮播图Service业务层处理
 *
 * @author HHAOYU
 * @date 2021-01-26
 */
@Service
public class CarouselFigureServiceImpl extends ServiceImpl<CarouselFigureMapper, CarouselFigure> implements ICarouselFigureService  {
    @Autowired
    private CarouselFigureMapper carouselFigureMapper;

    /**
     * 查询轮播图
     *
     * @param id 轮播图ID
     * @return 轮播图
     */
    @Override
    public CarouselFigure selectCarouselFigureById(Long id)
    {
        return carouselFigureMapper.selectCarouselFigureById(id);
    }

    /**
     * 查询轮播图列表
     *
     * @param carouselFigure 轮播图
     * @return 轮播图
     */
    @Override
    public List<CarouselFigure> selectCarouselFigureList(CarouselFigure carouselFigure)
    {
        return carouselFigureMapper.selectCarouselFigureList(carouselFigure);
    }

    /**
     * 新增轮播图
     *
     * @param carouselFigure 轮播图
     * @return 结果
     */
    @Override
    public int insertCarouselFigure(CarouselFigure carouselFigure)
    {
        carouselFigure.setCreateTime(DateUtils.getNowDate());
        return carouselFigureMapper.insertCarouselFigure(carouselFigure);
    }

    /**
     * 修改轮播图
     *
     * @param carouselFigure 轮播图
     * @return 结果
     */
    @Override
    public int updateCarouselFigure(CarouselFigure carouselFigure)
    {
        carouselFigure.setUpdateTime(DateUtils.getNowDate());
        return carouselFigureMapper.updateCarouselFigure(carouselFigure);
    }

    /**
     * 批量删除轮播图
     *
     * @param ids 需要删除的轮播图ID
     * @return 结果
     */
    @Override
    public int deleteCarouselFigureByIds(Long[] ids)
    {
        return carouselFigureMapper.deleteCarouselFigureByIds(ids);
    }

    /**
     * 删除轮播图信息
     *
     * @param id 轮播图ID
     * @return 结果
     */
    @Override
    public int deleteCarouselFigureById(Long id)
    {
        return carouselFigureMapper.deleteCarouselFigureById(id);
    }
}
